﻿<navigation:Page x:Class="AdventureWorksApp.Views.OrderList" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="OrderList Page" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:AdventureWorksApp.Web" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
    <Grid x:Name="LayoutRoot">
        <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:SalesOrderHeader, CreateList=true}" Height="0" LoadedData="salesOrderHeaderDomainDataSource_LoadedData" Name="salesOrderHeaderDomainDataSource" QueryName="GetSalesOrderHeaderQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:AdventureWorksContext />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <sdk:DataGrid 
            Name="salesOrderHeaderDataGrid"
            AutoGenerateColumns="False" 
            Height="Auto" MinHeight="200"
            Width="Auto" 
            HorizontalAlignment="Left" 
            VerticalAlignment="Top" 
            ItemsSource="{Binding ElementName=salesOrderHeaderDomainDataSource, Path=Data}" 
            RowDetailsVisibilityMode="VisibleWhenSelected" 
            >
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn x:Name="accountNumberColumn" Binding="{Binding Path=AccountNumber}" Header="Account Number" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="billToAddressIDColumn" Binding="{Binding Path=BillToAddressID}" Header="Bill To Address ID" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="commentColumn" Binding="{Binding Path=Comment}" Header="Comment" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="creditCardApprovalCodeColumn" Binding="{Binding Path=CreditCardApprovalCode}" Header="Credit Card Approval Code" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="customerIDColumn" Binding="{Binding Path=CustomerID}" Header="Customer ID" Width="SizeToHeader" />
                <sdk:DataGridTemplateColumn x:Name="dueDateColumn" Header="Due Date" Width="SizeToHeader">
                    <sdk:DataGridTemplateColumn.CellEditingTemplate>
                        <DataTemplate>
                            <sdk:DatePicker SelectedDate="{Binding Path=DueDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=DueDate, StringFormat=\{0:d\}}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
                <sdk:DataGridTextColumn x:Name="freightColumn" Binding="{Binding Path=Freight}" Header="Freight" Width="SizeToHeader" />
                <sdk:DataGridTemplateColumn x:Name="modifiedDateColumn" Header="Modified Date" Width="SizeToHeader">
                    <sdk:DataGridTemplateColumn.CellEditingTemplate>
                        <DataTemplate>
                            <sdk:DatePicker SelectedDate="{Binding Path=ModifiedDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=ModifiedDate, StringFormat=\{0:d\}}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
                <sdk:DataGridCheckBoxColumn x:Name="onlineOrderFlagColumn" Binding="{Binding Path=OnlineOrderFlag}" Header="Online Order Flag" Width="SizeToHeader" />
                <sdk:DataGridTemplateColumn x:Name="orderDateColumn" Header="Order Date" Width="SizeToHeader">
                    <sdk:DataGridTemplateColumn.CellEditingTemplate>
                        <DataTemplate>
                            <sdk:DatePicker SelectedDate="{Binding Path=OrderDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=OrderDate, StringFormat=\{0:d\}}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
                <sdk:DataGridTextColumn x:Name="purchaseOrderNumberColumn" Binding="{Binding Path=PurchaseOrderNumber}" Header="Purchase Order Number" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="revisionNumberColumn" Binding="{Binding Path=RevisionNumber}" Header="Revision Number" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="rowguidColumn" Binding="{Binding Path=rowguid}" Header="Rowguid" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="salesOrderIDColumn" Binding="{Binding Path=SalesOrderID, Mode=OneWay}" Header="Sales Order ID" IsReadOnly="True" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="salesOrderNumberColumn" Binding="{Binding Path=SalesOrderNumber}" Header="Sales Order Number" Width="SizeToHeader" />
                <sdk:DataGridTemplateColumn x:Name="shipDateColumn" Header="Ship Date" Width="SizeToHeader">
                    <sdk:DataGridTemplateColumn.CellEditingTemplate>
                        <DataTemplate>
                            <sdk:DatePicker SelectedDate="{Binding Path=ShipDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellEditingTemplate>
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=ShipDate, StringFormat=\{0:d\}}" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
                <sdk:DataGridTextColumn x:Name="shipMethodColumn" Binding="{Binding Path=ShipMethod}" Header="Ship Method" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="shipToAddressIDColumn" Binding="{Binding Path=ShipToAddressID}" Header="Ship To Address ID" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="statusColumn" Binding="{Binding Path=Status}" Header="Status" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="subTotalColumn" Binding="{Binding Path=SubTotal}" Header="Sub Total" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="taxAmtColumn" Binding="{Binding Path=TaxAmt}" Header="Tax Amt" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="totalDueColumn" Binding="{Binding Path=TotalDue}" Header="Total Due" Width="SizeToHeader" />
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
    </Grid>
</navigation:Page>
